Update quiver trace API - #7945
Conversation
847fd88 to
66fd95f
Compare
66fd95f to
7c9f063
Compare
| @@ -0,0 +1 @@ | |||
| - Rename `quiver` trace attributes for clarity and consistency: `sizeref` -> `lengthfactor`, `sizemode` -> `lengthmode`, `anglemode` -> `uvref` [[#7945](https://github.com/plotly/plotly.js/issues/7945)] | |||
There was a problem hiding this comment.
Hi @emilykl,
Since this feature is not released yet, I suggest you modify 7710_add.md log instead and mention this PR.
- Add `quiver` trace type to visualize vector fields using arrows [[#7710](https://github.com/plotly/plotly.js/pull/7710), [#7945
](https://github.com/plotly/plotly.js/pull/7945)], with thanks to @degzhaus for the contribution!
There was a problem hiding this comment.
I agree with this suggestion.
camdecoster
left a comment
There was a problem hiding this comment.
I left you a few suggestions. I like the new attribute names.
| @@ -0,0 +1 @@ | |||
| - Rename `quiver` trace attributes for clarity and consistency: `sizeref` -> `lengthfactor`, `sizemode` -> `lengthmode`, `anglemode` -> `uvref` [[#7945](https://github.com/plotly/plotly.js/issues/7945)] | |||
There was a problem hiding this comment.
I agree with this suggestion.
| // TODO: How to handle the case where there is just one point in a trace, | ||
| // or all points have the same x or y value? This will give a boxArea of 0. | ||
| // For now I'm going to just normalize to a vector of unit length (1) in that case, | ||
| // but that's not a great solution |
There was a problem hiding this comment.
Can this comment be addressed?
There was a problem hiding this comment.
Addressed by 1315d07. I updated the point distance calculation to be more accurate, and as a bonus now it covers the case where all the points are in a horizontal or vertical line.
There's nothing we can do about the case where all points have the same x or y value; I think it's reasonable to just default to 1 in that case.
| } else { // uvref === 'paper' | ||
| // TODO: For now, just do the same thing as for uvref === 'data', but this is not correct. | ||
| // We actually need more sophisticated logic here, since this will give a bad result | ||
| // if the data aspect ratio is very different from the plot aspect ratio. |
There was a problem hiding this comment.
Is there a follow up issue to track this?
Co-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
b46f29c to
1507db6
Compare
… case where all points are in a horizontal or vertical line
1507db6 to
1315d07
Compare
Closes #7944
Also:
arrowref(was'axis'which is not an accepted value; changed to'data')